﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Practices.Composite.Events;

namespace Razre
{
    /// <summary>
    /// Settings class to provide staticly stored values for the framework
    /// </summary>
    public static class Settings
    {
        #region ctors

        /// <summary>
        /// Static constructor to default the lock object
        /// </summary>
        static Settings()
        {
            _Lock = new object();
        }

        #endregion

        #region members

        /// <summary>
        /// Lock object used to ensure synchronous execution
        /// </summary>
        private static object _Lock { get; set; }

        private static IEventAggregator _eventAggregator;
        
        /// <summary>
        /// Event Aggregator to be used by the framework.
        /// It is advised to create one that is re-used in the application itself and pass it into here to ensure all objects use the same aggregator.
        /// </summary>
        public static IEventAggregator EventAggregator
        {
            get
            {
                lock (_Lock)
                {
                    return _eventAggregator;
                }
            }
            set
            {
                lock (_Lock)
                {
                    _eventAggregator = value;
                }
            }
        }

        #endregion
    }
}
